﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kralizek.StarCraft2.ReplayParser;
using System.IO;

namespace TestApplication
{
    class Program
    {
        static void Main(string[] args)
        {

            var files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.SC2Replay");

            Console.WriteLine("Choose your replay");
            int i = 0;
            foreach (string file in files)
            {
                i++;
                Console.WriteLine(string.Format("{0}: {1}", i, file));
            }

            string selected = Console.ReadLine();
            int selectedIndex = 0;
            if (int.TryParse(selected, out selectedIndex))
            {
                var gameInfo = ReplayParser.Load(files[selectedIndex - 1]);

                Console.WriteLine("--- Replay parsed ---");

                Console.WriteLine("Game speed: " + gameInfo.GameSpeed);

                Console.WriteLine("Map: " + gameInfo.Map.Name);

                Console.WriteLine("\tImage size: " + gameInfo.Map.Thumbnail.Height + "x" + gameInfo.Map.Thumbnail.Width);

                Console.WriteLine("Players: " + gameInfo.Players.Count());

                foreach (Player player in gameInfo.Players)
                    Console.WriteLine(string.Format("\tName: {0}\n\r\tRace: {1}\n\r\tHuman: {2}\n\r\tColor: {3}\n\r", player.Name, player.Race.ToString(), player.IsHuman, player.Color.Name));
            }
            Console.ReadLine();

            
        }
    }
}
